package com.zhanbo.zhanbowymusic.main.featured;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.flyco.tablayout.listener.OnTabSelectListener;
import com.mwx.baselib.utils.MLog;
import com.zhanbo.zhanbowymusic.R;
import com.zhanbo.zhanbowymusic.databinding.FragmentFeatureBinding;
import com.mwx.baselib.base.BaseFragment;

import java.util.ArrayList;

/**
 * 云音乐精选fragment
 */
public class FeaturedFragment extends BaseFragment<FragmentFeatureBinding> {

//    private String[] mTitlesArrays ={"精选","排行榜","歌手","VIP"};
    private String[] mTitlesArrays ={"精选","排行榜","歌手"};
    private ArrayList<Fragment> fragments;
    @Override
    protected void init(Bundle savedInstanceState) {
        initView();
        initData();
        initListener();
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
            super.onLazyInitView(savedInstanceState);

    }

    @Override
    protected Object getLayout() {
        MLog.e("R.layout.fragment_feature");
        return R.layout.fragment_feature;
    }


    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        fragments = new ArrayList<>();
        fragments.add(FeaturedListFragment.newInstance());
        fragments.add(RankingListFragment.newInstance());
        fragments.add(SingerListFragment.newInstance());
//        fragments.add(VipListFragment.newInstance());
        binding.tabFeatured.setViewPager(binding.vpFeatured,mTitlesArrays,getActivity(),fragments);
        binding.vpFeatured.setOffscreenPageLimit(4);


    }

    @Override
    protected void initListener() {
        binding.tabFeatured.setOnTabSelectListener(new OnTabSelectListener() {
            @Override
            public void onTabSelect(int position) {
                switch (position){
                    case 0:
                        break;
                }
            }

            @Override
            public void onTabReselect(int position) {

            }
        });

    }
    public static FeaturedFragment newInstance() {

        Bundle args = new Bundle();

        FeaturedFragment fragment = new FeaturedFragment();
        fragment.setArguments(args);
        return fragment;
    }
}